22 int a
[50005], b
[50005];
27 Sorts the elements from numbers [start ... end) in decreasing order
28 and returns the number of inversions in that piece of array.
30 long long merge_sort(int start
, int end
){
32 if (start
+ 1 == end
){ //Single element
36 int m
= (start
+ end
)/2;
37 cnt
+= merge_sort(start
, m
) + merge_sort(m
, end
);
39 int _a
= m
- start
, _b
= end
- m
;
40 for (int i
=start
; i
<start
+_a
; ++i
){
41 a
[i
-start
] = numbers
[i
];
44 for (int i
=m
; i
<m
+_b
; ++i
){
48 for (int i
=0, j
=0; i
<_a
&& j
<_b
; ){
50 cnt
+= (long long)(_b
- j
);
59 for (int k
=start
, i
=0, j
=0; k
<end
; ++k
){
72 while (scanf("%d", &n
)==1 && n
){
73 for (int i
=0; i
<n
; ++i
){
74 scanf("%d", &numbers
[i
]);
77 long long cnt
= merge_sort(0, n
);
78 //printf("%lld\n", cnt);
79 puts((cnt
% 2 ? "Marcelo" : "Carlos"));